package com.spring.study.controller;


import com.spring.study.mapper.GoodMapper;
import com.spring.study.pojo.Good;
import com.spring.study.service.GoodService;
import com.spring.study.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/good")
public class GoodController {


    @Autowired
    private GoodService goodService;


    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public ResultUtil<String> addGood(@RequestBody @Validated Good good){
        goodService.addGood(good);
        return ResultUtil.success();
    }
}
